package com.tbit.main.service.impl;

import com.tbit.main.constant.DaoParamConstant;
import com.tbit.main.dao.stat.AccountDataDayStaDao;
import com.tbit.main.pojo.AccountDataDaySta;
import com.tbit.main.pojo.BrandDataDaySta;
import com.tbit.main.service.AccountDataDayStaService;
import com.tbit.main.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @author LMY
 * @create 2022-03-30 17:04
 * 区域对账数据日统计
 */
@Service("accountDataDayStaService")
public class AccountDataDayStaServiceImpl implements AccountDataDayStaService {

    @Autowired
    private AccountDataDayStaDao accountDataDayStaDao;

    @Override
    public List<BrandDataDaySta> getByAccountIdAndTimeCount(List<Integer> accountIds, String startTime, String endTime) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountIds, StringUtil.getListString(accountIds));
        map.put(DaoParamConstant.startTime, startTime);
        map.put(DaoParamConstant.endTime, endTime);
        return accountDataDayStaDao.getByAccountIdAndTimeCount(map);
    }

    @Override
    public List<AccountDataDaySta> getByAccountIdAndTime(List<Integer> accountId, String startTime, String endTime) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountId, StringUtil.getListString(accountId));
        map.put(DaoParamConstant.startTime, startTime);
        map.put(DaoParamConstant.endTime, endTime);
        return accountDataDayStaDao.getByAccountIdAndTime(map);
    }

    @Override
    public BrandDataDaySta getByAccountITimeMoney(Integer accountId, String startTime, String endTime) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountId, accountId);
        map.put(DaoParamConstant.startTime, startTime);
        map.put(DaoParamConstant.endTime, endTime);
        return accountDataDayStaDao.getByAccountITimeMoney(map);
    }

    @Override
    public BrandDataDaySta getByAccountITimeCount(Integer accountId, String startTime, String endTime) {
        Map<String, Object> map = new HashMap<>();
        map.put(DaoParamConstant.accountId, accountId);
        map.put(DaoParamConstant.startTime, startTime);
        map.put(DaoParamConstant.endTime, endTime);
        return accountDataDayStaDao.getByAccountITimeCount(map);
    }

}
